package com.apinji.common.domain.mapper;

import com.apinji.common.domain.OpenCardLog;
import org.apache.ibatis.annotations.*;

/**
 * Created by 轩辕夏夏 on 2017/7/6.
 */
@Mapper
public interface OpenCardLogMapper {

    @Insert("insert into apin_opencard_log(id, useruuid, orderid, cardtype, cvn2, expired, cardno, phoneno, createtime, smscode, version, merid, outorderid, txntime, acctype, tokenpaydata, opentype, status, memo, fronturl, backurl) " +
            " values(#{id},  #{userUUID}, #{orderId}, #{cardType}, #{cvn2}, #{expired}, #{cardNo}, #{phoneNo}, #{createTime}, #{smsCode}, #{version}, #{merId}, #{outOrderId}, #{txnTime}, #{accType}, #{tokenPayData}, #{openType}, #{status}, #{memo}, #{frontUrl}, #{backUrl})")
    void addOneItem(OpenCardLog openCardLog);


    @Select("select * from apin_opencard_log where id = #{id}")
    OpenCardLog getOneItem(@Param("id") String id);

    @Select("select * from apin_opencard_log where outorderid = #{outOrderId}")
    OpenCardLog getOneItemByOutOrderId(@Param("outOrderId") String outOrderId);


    @Update("update apin_opencard_log set status = #{status}, memo = #{memo} where id = #{id}")
    void updateLogStatus(@Param("id") String id, @Param("status") String status, @Param("memo") String memo);
}
